Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix update document with knnn_vector size not matching issue #208

Merged
merged 10 commits into from
Jul 11, 2023

Conversation

zane-neo
Copy link
Collaborator

@zane-neo zane-neo commented Jul 5, 2023

Description

This PR fixed the issue when updating a document with knn_vector field, the update fails because the vector dimension is not matching the required dimension.

Issues Resolved

#207

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed as per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@navneet1v
Copy link
Collaborator

navneet1v commented Jul 5, 2023

@zane-neo before PR can be reviewed, can you check why gradle checks are failing?

@zane-neo
Copy link
Collaborator Author

zane-neo commented Jul 6, 2023

@zane-neo before PR can be reviewed, can you check why gradle checks are failing?

Added commons-lang3 back, in my local even I removed this dependency the project can be compiled successfully, and adding back this can cause jar hell issue when building neural-search plugin, but it seems have to add it back to pass the build.

@navneet1v
Copy link
Collaborator

@zane-neo the build and test gradle check is still failing. Please fix them.

@zane-neo
Copy link
Collaborator Author

@zane-neo the build and test gradle check is still failing. Please fix them.

@navneet1v opensearch core changed some classes breaking the code build, I've created a PR to fix this issue in k-NN repo: opensearch-project/k-NN#958, please help take a look. Thanks.

@@ -119,7 +117,7 @@ void appendVectorFieldsToDocument(IngestDocument ingestDocument, Map<String, Obj
Objects.requireNonNull(vectors, "embedding failed, inference returns null result!");
log.debug("Text embedding result fetched, starting build vector output!");
Map<String, Object> textEmbeddingResult = buildTextEmbeddingResult(knnMap, vectors, ingestDocument.getSourceAndMetadata());
textEmbeddingResult.forEach(ingestDocument::appendFieldValue);
textEmbeddingResult.forEach(ingestDocument::setFieldValue);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we rename the function from appendVectorFieldsToDocument to setVectorFieldsToDocument, as we are not appending the values

Signed-off-by: zane-neo <[email protected]>
@zane-neo
Copy link
Collaborator Author

Build is failing caused by opensearch core breaking change, and is fixed by k-NN team in this PR: opensearch-project/k-NN#963.

@zane-neo zane-neo merged commit 9599371 into opensearch-project:2.x Jul 11, 2023
11 of 12 checks passed
@zane-neo zane-neo added the backport 2.x Label will add auto workflow to backport PR to 2.x branch label Jul 11, 2023
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.x 2.x
# Navigate to the new working tree
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-208-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 95993717e59b31bcd0facc76b0c702aa6857b8f8
# Push it to GitHub
git push --set-upstream origin backport/backport-208-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-208-to-2.x.

zane-neo added a commit to zane-neo/neural-search that referenced this pull request Jul 11, 2023
…rch-project#208)

* Fix update document with knnn_vector size not matching issue

Signed-off-by: zane-neo <[email protected]>

* Add apache common lang3 back to fix  PR gradle build failure

Signed-off-by: zane-neo <[email protected]>

* Fix PR check failure

Signed-off-by: zane-neo <[email protected]>

* Fix PR check failure

Signed-off-by: zane-neo <[email protected]>

* Fix PR check jar hell failure

Signed-off-by: zane-neo <[email protected]>

* Add apache common lang back to fix the PR check

Signed-off-by: zane-neo <[email protected]>

* Fix register model group failure in IT

Signed-off-by: zane-neo <[email protected]>

* format code

Signed-off-by: zane-neo <[email protected]>

* Rename the method appendVectorFieldsToDocument to setVectorFieldsToDocument

Signed-off-by: zane-neo <[email protected]>

* format code

Signed-off-by: zane-neo <[email protected]>

---------

Signed-off-by: zane-neo <[email protected]>
(cherry picked from commit 9599371)
@zane-neo zane-neo mentioned this pull request Jul 11, 2023
5 tasks
@junqiu-lei
Copy link
Member

junqiu-lei commented Jul 11, 2023

Looks like this PR directly merged to 2.x branch instead of main, I am adding 2.9 release tag for the PR and adding to 2.9 release note. @zane-neo @ylwu-amzn

@junqiu-lei junqiu-lei added v2.9.0 Bug Fixes Changes to a system or product designed to handle a programming bug/glitch and removed backport 2.x Label will add auto workflow to backport PR to 2.x branch labels Jul 11, 2023
@navneet1v
Copy link
Collaborator

@zane-neo this PR also needs to be raised on main branch.

Please going forward follow the below practice.
The first PR needs to be raised against the main branch first, then once it is approved it needs to be backported to 2.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Fixes Changes to a system or product designed to handle a programming bug/glitch skip-changelog v2.9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants